package 网易互联网20210821;

import java.util.Arrays;
import java.util.Scanner;

/**
 @author fujiangnan
 @create 2021-08-21-15-56
 @desc 纸张分配
 */
public class Main2 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String s = scanner.nextLine();
        String[] s1 = s.split(" ");
        int[] arr = new int[s1.length];
        for (int i = 0; i < s1.length; i++) {
            arr[i] = Integer.parseInt(s1[i]);
        }
        System.out.println(maxPaper(arr));

    }
    public static int maxPaper(int[] arr) {
        if (arr.length == 1) {return 1;}
        int[] arr1 = new int[arr.length];
        int[] arr2 = new int[arr.length];
        Arrays.fill(arr1, 1);
        Arrays.fill(arr2, 1);
        for (int i = 1; i < arr.length; i++) {
            if (arr[i]>arr[i-1]) {
                arr1[i] = arr1[i-1]+1;
            }
        }
        int res = arr1[arr.length-1];
        for (int i = arr.length-2; i >=0; i--) {
            if (arr[i]>arr[i+1]) {
                arr2[i] = arr2[i+1] + 1;
            }
            res += Math.max(arr1[i], arr2[i]);
        }

        return res;
    }
}
